<div class="main-header">
    <div class="btn-list">
        <a href="javascript:void(0)" id="newItem" ng-click="edit()">
            <span class="glyphicon glyphicon-plus"></span>新增巡查任务
        </a>
    </div>
</div>
<div class="main-con">
    <div class="row">
        <!--list -->

        <div class="col-xs-4">
            <div class="lft-wrap box-shadow" when-scrolled="getinspectionList()">
                <search-box search-list="searchList" search-result="searchResult" search-url="/search/type"></search-box>
                <div class="result-bar">
                    共<span class="mColor" ng-bind="inspectionList.length"></span>条记录
                </div>
                <ul class="data-list" repeat-list="getRgtModel()" active-id="{{activeId}}">
                    <li ng-repeat="item in inspectionList track by $index" relativeId="{{item.Id}}" ng-class="{active:$index==0}">
                        <div class="media-left">
                            <div class="icon-box">
                                <img ng-if="item.Icon" class="media-object img-circle" alt="" width="60" height="60" ng-src="{{item.Icon}}">
                                <i ng-if="!item.Icon" class="glyphicon glyphicon-eye-open"></i>
                            </div>
                        </div>

                        <div class="media-body">
                            <div class="panel-info">
                                <dl>
                                    <dt>维修任务编号:</dt>
                                    <dd ng-bind="item.Id"></dd>
                                </dl>
                                <dl>
                                    <dt>状态:</dt>
                                    <dd>
                                        <span class="label-warning label" ng-bind="MissionLevel|getEmunName:item.MissionLevel"></span>
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>来源:</dt>
                                    <dd ng-bind="item.HandlerName"></dd>
                                </dl>
                                <dl>
                                    <dt>紧急程度:</dt>
                                    <dd>
                                        <span class="label-warning label" ng-bind="MissionLevel|getEmunName:item.MissionLevel"></span>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="media-right">
                            <div class="btn-wrap">
                                <a ng-class="{disabled:item.MissionStatus==1}" href="javascript:void(0)" title="编辑" ng-click="edit(item,$index);$event.stopPropagation();">
                                    <span class="glyphicon glyphicon-edit"></span></a>
                                <a href="javascript:void(0)" title="删除" ng-click="del(item,$index);$event.stopPropagation();">
                                    <span class="glyphicon glyphicon-trash"></span></a>
                                <a ng-class="{disabled:item.MissionStatus==1}" href="javascript:void(0)" ng-click="mission(item);$event.stopPropagation();">
                                    <span class="glyphicon glyphicon-share-alt" title="派发"></span></a>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <!--内容块-->
        <div class="col-xs-8">
            <div class="rgt-wrap box-shadow">
                <div class="widget flat radius-bordered">
                    <tabset flat="true">
                        <tab heading="位置信息">
                            <!--地图信息-->
                            <wtmap-set-location option="setLocationOption"  position="position"></wtmap-set-location>
                        </tab>
                        <tab heading="详细信息">
                            <div class="row">
                                <div class="panel-info report">
                                    <dl>
                                        <dt>维修任务编号:</dt>
                                        <dd ng-bind="inspectionDetailModel.Id"></dd>
                                    </dl>
                                    <dl>
                                        <dt>状态:</dt>
                                        <dd ng-bind="MissionLevel|getEmunName:inspectionDetailModel.MissionLevel"></dd>
                                    </dl>
                                    <dl>
                                        <dt>紧急程度:</dt>
                                        <dd ng-bind="inspectionDetailModel.HandlerName"></dd>
                                    </dl>
                                    <dl>
                                        <dt>处理人:</dt>
                                        <dd ng-bind="inspectionDetailModel.Note"></dd>
                                    </dl>
                                    <dl>
                                        <dt>创建时间:</dt>
                                        <dd ng-bind="inspectionDetailModel.Remark"></dd>
                                    </dl>
                                    <dl>
                                        <dt>创建人:</dt>
                                        <dd ng-bind="inspectionDetailModel.Remark"></dd>
                                    </dl>
                                    <dl>
                                        <dt>来源:</dt>
                                        <dd ng-bind="inspectionDetailModel.Remark"></dd>
                                    </dl>
                                    <dl>
                                        <dt>来源编号:</dt>
                                        <dd ng-bind="inspectionDetailModel.Remark"></dd>
                                    </dl>
                                    <dl>
                                        <dt>维修要点:</dt>
                                        <dd ng-bind="inspectionDetailModel.Remark"></dd>
                                    </dl>
                                </div>
                            </div>
                            <div class="thumbs" id="inspectionThumbs">
                                <a target-href="{{item.Url}}" style="background-image:url({{item.Url}})" thumbs-list="inspectionThumbs" ng-repeat="item in rgtinspectionDetailModel.Imgs track by $index"></a>
                            </div>
                        </tab>
                        <tab heading="巡查内容">
                            <table class="table table-hover">
                                <thead class="bordered-darkazure">
                                    <tr>
                                        <th>
                                            类型
                                        </th>
                                        <th>
                                            编号
                                        </th>
                                        <th>
                                            描述
                                        </th>
                                        <th>
                                            地址
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="item in inspectionDetailModel.Items track by $index">
                                        <td>
                                            <span ng-if="item.TargetKind==1">设施</span>
                                            <span ng-if="item.TargetKind==2">隐患</span>
                                        </td>
                                        <td ng-bind="item.TargetCode"></td>
                                        <td ng-bind="item.Note"></td>
                                        <td ng-bind="item.TargetAddr"></td>
                                    </tr>
                                    <tr class="no-record" ng-if="inspectionDetailModel.Items.length==0">
                                        <td colspan="4">暂无记录</td>
                                    </tr>
                                </tbody>
                            </table>
                        </tab>
                    </tabset>
                </div>
            </div>
        </div>
    </div>
</div><!-- 编辑设施信息 -->
<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <form name="inspectionForm" ng-submit="inspectionFormSubmit()" novalidate>
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span> <span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title" ng-bind="editModalTitle"></h4>
                </div>
                <div class="modal-body">
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.MissionLevel.$dirty&&inspectionForm.MissionLevel.$invalid}">
                        <div class="input-icon icon-right">
                            <select name="MissionLevel" class="form-control" ng-model="inspectionModel.MissionLevel" ng-options="value as key for (key ,value) in MissionLevel" required>
                                <option value="" disabled selected>请选择(紧急程度)</option>
                            </select>
                            <p ng-show="inspectionForm.MissionLevel.$dirty && inspectionForm.MissionLevel.$error.required" class="help-block">紧急程度是必需的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.MissionMold.$dirty&&inspectionForm.MissionMold.$invalid}">
                        <div class="input-icon icon-right">
                            <select name="MissionMold" class="form-control" ng-model="inspectionModel.MissionMold" ng-options="value as key for (key ,value) in MissionMold" required>
                                <option value="" disabled selected>请选择(任务模式)</option>
                            </select>
                            <p ng-show="inspectionForm.MissionMold.$dirty && inspectionForm.MissionMold.$error.required" class="help-block">任务模式是必需的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.Note.$dirty&&inspectionForm.Note.$invalid}">
                        <div class="input-icon icon-right">
                            <input name="Note" type="text" class="form-control" ng-model="inspectionModel.Note" placeholder="任务描述" required>
                            <p ng-show="inspectionForm.Note.$dirty && inspectionForm.Note.$error.required" class="help-block">任务描述是必需的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.Remark.$dirty&&inspectionForm.Remark.$invalid}">
                        <div class="input-icon icon-right">
                            <input name="Remark" type="text" class="form-control" ng-model="inspectionModel.Remark" placeholder="备注" required>
                            <p ng-show="inspectionForm.Remark.$dirty && inspectionForm.Remark.$error.required" class="help-block">备注是必需的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.DeviceId.$dirty&&inspectionForm.DeviceId.$invalid}">
                        <div class="input-icon icon-right">
                            <input type="text" name="DeviceName" class="form-control" placeholder="设施点" ng-model="inspectionModel.DeviceName">
                            <input ng-show="false" type="text" name="DeviceId" class="form-control" placeholder="设施点名称" ng-model="inspectionModel.DeviceId">
                            <i class="fa fa-map-marker circular" ng-click="openDeviceSelect()"></i>
                            <p ng-show="inspectionForm.DeviceId.$dirty && inspectionForm.DeviceId.$error.required" class="help-block">设施点是必需的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.HandlerId.$dirty&&inspectionForm.HandlerId.$invalid}">
                        <div class="input-icon icon-right">
                            <select name="HandlerId" class="form-control" ng-disabled="id" ng-model="inspectionModel.HandlerId" ng-options="item.Id as item.Name for item in userList" required>
                                <option value="" disabled selected>请选择(处理人员)</option>
                            </select>
                            <p ng-show="inspectionForm.HandlerId.$dirty && inspectionForm.HandlerId.$error.required" class="help-block">处理人员的，并且不能是空的</p>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary" ng-disabled="inspectionForm.$invalid">确定</button>
                    <button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
                </div>
            </div>
        </form>
    </div>
</div>

<!-- 删除用户 -->
<div class="modal fade" id="delModal">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">&times;</span> <span class="sr-only">Close</span>
                </button>
                <h4 class="modal-title">确定删除吗?</h4>
            </div>
            <div class="modal-body">
                <div class="panel-info">
                    <dl>
                        <dt>Id:</dt>
                        <dd ng-bind="delModel.Id"></dd>
                    </dl>
                    <dl>
                        <dt>紧急程度:</dt>
                        <dd>
                            <span class="label-warning label" ng-bind="MissionLevel|getEmunName:delModel.MissionLevel"></span>
                        </dd>
                    </dl>
                    <dl>
                        <dt>处理人:</dt>
                        <dd ng-bind="delModel.HandlerName"></dd>
                    </dl>
                    <dl>
                        <dt>上报时间:</dt>
                        <dd ng-bind="delModel.StartAt"></dd>
                    </dl>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" ng-click="delConfirm()">确定</button>
            </div>
        </div>
    </div>
</div>
<!--选择设施-->
<div class="modal fade" id="deviceSelectModal">

    <div class="modal-dialog" style="background:#ffffff;width:800px;">
        <div class="modal-content">
            <div class="modal-header">

                <button type="button" class="btn btn-primary pull-right" ng-click="closeDeviceSelect()">确 定</button>
                <h4 class="modal-title">选择巡查设施</h4>
            </div>
            <div class="modal-body">
                <wtmap-pointselect toolitems="pointselectOption.toolItems" pointlayers="pointselectOption.pointLayers" resultdatas="pointselectOption.selecedresults" initialayer="pointselectOption.initialayer"></wtmap-pointselect>
            </div>

        </div>
    </div>
</div>